#ifndef MSGH
#define MSGH
#define DEFAULTMSGSIZE 80
#include <string>
#include <sstream>
#include <iomanip>
#include <iostream>
#include <list>

//note : see fct clearScreen() in the cpp for platform variable (your platform needs to be recongnized as windows or unix like)
using namespace std;

namespace msg
{	
	extern int __step_nb;
	extern bool __numbering_paused;
	extern string last_section;
	
	string boolToYesNo(bool value);
		

	void Info(string txt, char borderStartAndEndAndBackground='*', char background='X',char borderEndOverride='X',int msgSize=DEFAULTMSGSIZE, bool autoCenter=true);
	
	void ClearScreen();
	
	void Pause(bool clearScreen=true,string otherMessage="Press enter to continue");
	
	void BigTitle(string txt);
	
	void Section(string txt);
	
	void SectionEnd();
	
	void Underlined(string txt);
	
	void Step(string txt,int restartPauseContinueNumbering=-1);
	
	class MenuItem
	{
		public:
			MenuItem(void (*testFctPtr) ()=NULL,string description="");
			void (*testFctPtr) ();
			string description; //keep it here to accessed by the Menu display for loop
	};
	
	class Menu
	{
		public:
			Menu(string my_title);
			
			void add(MenuItem& i);
			
			void run();
			
			//description of items along with numbers for user to choose + a quit choice as a last item
			void displayList();
			
			//keeps asking for a valid choice among those proposed in the menu
			//return values :
			//0:keep going, because good input by user & did not ask for quit
			//1:keep going, but user made a mistake input : write that did not understand input
			//2:user asked to quit
			int getInput();
		private:
			list<MenuItem> menuItems;
			string my_title;
	};
	
}
#endif
